<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>管理中心 - 添加公告 </title>
        <meta name="robots" content="noindex, nofollow"/>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="__PUBLIC__/styles/general.css" rel="stylesheet" type="text/css" />
        <link href="__PUBLIC__/styles/main.css" rel="stylesheet" type="text/css" />
        <script language="JavaScript" src="__PUBLIC__/Js/jquery.js"></script>
        <script src="__PUBLIC__/js/ajaxupload.js" type="text/javascript"></script>
        <script type="text/javascript" src="__PUBLIC__/js/ckeditor/ckeditor.js"></script>

    </head>
    <body>

        <h1>
            <span class="action-span"><a href="__APP__/Admin/Notice/showList">公告列表</a></span>
            <span class="action-span1"><a href="index.php?act=main">管理中心</a> </span><span id="search_id" class="action-span1"> - 添加公告</span>
            <div style="clear:both"></div>
        </h1>
        <!-- start add new category form -->
        <div class="main-div">
            <form action="__APP__/Admin/Notice/add" method="post" name="theForm">
                <table width="100%" id="general-table">
                   
                    <tr id="measure_unit">
                        <td class="label">标题:</td>
                        <td>
                            <input type="text" name="title" value="{$notice.title}"/>
                        </td>
                    </tr>
                    <tr id="measure_unit">
                        <td class="label">类型:</td>
                        <td>
                            <input type="radio" name="type" value="0" checked/>公告
                            <input type="radio" name="type" value="1"/>广告软文
                        </td>
                    </tr>
                    <tr>
                        <td class="label">正文:</td>
                        <td>
                            <textarea id="content" name="content">{$notice.content|html_entity_decode=###|stripslashes=###}</textarea>
                            <br>
                            <input id="upload_button" type="button" value="添加相关图片（限于png，gif，jpg，jpeg格式，大小限制3M" />
                        </td>
                    </tr>
                </table>
                <div class="button-div">
                    <input type="hidden" value="{$notice.id}" name="id"/>
                    <input type="submit" value=" 确定 " class="button"/>
                    <input type="reset" value=" 重置 " class="button"/>
                </div>

            </form>
        </div>


        <div id="footer">
        </div>

    </body>
</html>
<script>CKEDITOR.replace( 'content',{skin : 'kama'});
$(document).ready(function(){

        var button = $('#upload_button'), interval;
        var fileType = "all",fileNum = "one";

        new AjaxUpload(button,{
            action: '__APP__/Home/Share/uploadPic',
            /*data:{
            'buttoninfo':button.text()
        },*/
            name: 'photo',
            onSubmit : function(file, ext){

            },
            onComplete: function(file, response){
                if(response != "success"){
                    img = '<img id="user_pic" align=center src="__ROOT__/Public/Uploads/thumb_'+ response+"\"/>";
                    CKEDITOR.instances.content.insertHtml(img);

                    window.clearInterval(interval);

                }
                if(response == "success"){
                    alert('图片类型错误，请重试！');
                }
            }
        });

    });
</script>